<!--
 * @Description: 
 * @Autor: zhangbing
 * @Date: 2021-07-28 13:23:42
 * @LastEditors: zhangbing
 * @LastEditTime: 2021-07-28 14:20:20
-->

<template>
  <div class="wrraper" @click="radioCheck($event)">
    <radio-btn v-for="(item, index) of subjects" 
    :key="index" 
    :item="item" 
    :index="index" 
    :curIdx="curIdx" 
    />
  </div>
</template>

<script>
import RadioBtn from "./Button.vue";

export default {
  name: "BtnRadios",
  components: {
    RadioBtn,
  },
  props: {
    subjects: Array,
  },
  data() {
    return {
      curIdx: 0,
    };
  },
  created() {},
  mounted() {},
  methods: {
    radioCheck(e) {
      console.log(e.target);
      const tar = e. target

      const className = tar.className
      console.log(className);

      if(className === 'radio-btn') {
        const index = parseInt(tar.dataset.index)
        this.curIdx = index
      }
    }
  },
};
</script>

<style>
</style>
